<?php
namespace App\Controllers\Expand;

use App\Models\Expand\ExpandIncome;

/**
*	推广--我的收益汇总数据
*/

class Expand_income_collect extends \App\Controllers\Common\Base
{
	
	public function execute(){
		$uid = 1;
		$nowDate = date("Y-m-d",time())." 00:00:00";
		
		$totalExpand = ExpandIncome::sum( array(
			'conditions'=> 'uid = '.$uid,
			'column'=>'price'
		) );
		
		$totalExpandNowDate = ExpandIncome::sum( array(
			'conditions'=> "uid = {$uid} and ctime >= '{$nowDate}'",
			'column'=>'price'
		) );
		
		$info['totalExpand'] = $totalExpand;
		$info['totalExpandNowDate'] = $totalExpandNowDate;
		//$info['expandPrice'] = $this->session->user->home_price;
		$info['expandPrice'] = 1000;
		if( empty( $info ) ){
			 return \App\Libs\Views\Json::view(0, '成功', []);
		}else{
			 return \App\Libs\Views\Json::view(0, '成功', $info);
		}
		
       
    }

}
